package com.wlr.study.leetcode;

public class LeetCode27 {
    public static int removeElement(int[] nums, int val) {
        int i = 0, j = 0;
        while (j < nums.length){
            if (nums[j] != val) {
                nums[i] = nums[j];
                i++;
            }
            j++;
        }
        return i;

    }

    public static void main(String[] args) {
        System.out.println(LeetCode27.removeElement(new int[]{0,1,2,2,3,0,4,2}, 2));
    }
}
